<?php
/**
 * Created by PhpStorm.
 * 店铺运营分类模型
 * User: caicm
 * Date: 2017/6/15
 * Time: 19:08
 */

namespace WMApi\Model;


use Think\Model;

class WmStoreClassifyModel extends Model {

    /**
     * 获取分类列表
     * Created By caicm
     * @param int $parent_id
     * @return mixed
     */
    public function find_classify_list($parent_id=0){

        $where = array(
            'is_show' => 1,
            'is_del' => 0,
            'parent_id' => $parent_id
        );

        $field = 'classify_id,classify_name';

        $list = $this->field($field)->where($where)->select();

        return $list ;

    }

    /**
     * 获取父级分类id
     * Created By caicm
     * @param int $classify_id
     * @return mixed
     */
    public function find_parent_classify_id($classify_id=0){

        $where = array(
            'classify_id' => $classify_id
        );

        return $this->where($where)->getField('parent_id');

    }
}